#include "lua_string.h"
#include <iostream>
using namespace std;
int luaSplit(lua_State *L)
{
	const char *str=luaL_checkstring(L,1);
	const char *split=luaL_checkstring(L,2);
	int n=1;
	char des[128];
	strcpy(des, str);
	char *p=strtok (des,split); 
	lua_newtable(L);
	while(p!=NULL) {
		//cout<<"p="<<p<<endl;
		lua_pushnumber(L, n++);
		lua_pushstring(L, p);
		lua_settable(L,-3);
		p = strtok(NULL,split); 
	}
	return 1;
}